<?php   // $Id: users_lister.php 236 2008-07-06 21:58:41Z pcoustillas $ ?>
<?php   
/*Copyright (C) 2003-2004 Guy Hendrickx
Licensed under the terms of the GNU  General Public License:http://www.opensource.org/licenses/gpl-license.php
File Authors:Guy Hendrickx
Modification : Pierre Coustillas*/

require_once("include/verif.php");
require_once("include/config/common.php");
require_once("include/language/$lang.php");
require_once("include/utils.php");
require_once("include/headers.php");

?>
<script language="JavaScript" type="text/javascript">
function confirmDelete2()
{
	var agree=confirm('<?php echo "$lang_con_effa_utils"; ?>');
	if (agree)
		return true ;
	else
		return false ;
}
</script>

<table width="760" border="0" class="page" align="center">
	<tr>
		<td class="page" align="center">
			<?php
				require_once("include/head.php");
			?>
		</td>
	</tr>
	<tr>
		<td class="page" align="center">
			<?php   
			if ($user_admin != "y") { 
				echo "<h1>$lang_admin_droit $user_admin A</h1>";
				exit;
			}

			if (isset($_GET['message']))
			{
				echo "<h1>" . $_GET['message'] . "</h1>";
			}
			
			$sql = " SELECT * FROM ${tblpref}user ORDER BY `nom` ASC";
			$req = mysql_query($sql) or die("Erreur SQL selection users !<br/>$sql<br/>" . mysql_error());
			?>
			<center>
				<table class="boiteaction">
					<caption><?php echo "Les utilisateurs"; ?></caption>
					<tr>
						<th>&nbsp;<?php echo $lang_nom; ?>&nbsp;</th>
						<th>&nbsp;<?php echo "Prénom"; ?>&nbsp;</th>
						<th>&nbsp;<?php echo "Login"; ?>&nbsp;</th>
						<th>&nbsp;<?php echo "Est admin"; ?>&nbsp;</th>
						<th>&nbsp;<?php echo "Gérer devis"; ?>&nbsp;</th>
						<th>&nbsp;<?php echo "Gérer commandes"; ?>&nbsp;</th>
						<th>&nbsp;<?php echo "Gérer factures"; ?>&nbsp;</th>
						<th>&nbsp;<?php echo "Gérer depenses"; ?>&nbsp;</th>
						<th>&nbsp;<?php echo "Voir stat."; ?>&nbsp;</th>
						<th>&nbsp;<?php echo "Gérer art."; ?>&nbsp;</th>
						<th>&nbsp;<?php echo "Gérer client"; ?>&nbsp;</th>
						<th>&nbsp;<?php echo "Modifier"; ?>&nbsp;</th>
						<th>&nbsp;<?php echo "Supprimer"; ?>&nbsp;</th>
					</tr>
					<?php  
					$nombre =1;
					while($data = mysql_fetch_array($req))
					{
						$nom = $data['nom'];
						$prenom = $data['prenom'];
						$login = $data['login'];

						$dev = $data['dev'];
						if ($dev == "y") { $dev = $lang_oui ;}
						if ($dev == "n") { $dev = $lang_non ; }
						if ($dev == "r") { $dev = "Lecture seul" ; }
						
						$com = $data['com'];
						if ($com == "y") { $com = $lang_oui ; }
						if ($com == "n") { $com = $lang_non ; }
						if ($com == "r") { $com = "Lecture seul" ; }

						$fact = $data['fact'];
						if ($fact == "y") { $fact = $lang_oui ; }
						if ($fact == "n") { $fact = $lang_non ; }
						if ($fact == "r") { $fact = "Lecture seul" ; }

						//$mail =$data['mail'];

						$dep = $data['dep'];
						if ($dep == "y") { $dep = $lang_oui ; }
						if ($dep == "n") { $dep = $lang_non ; }

						$stat = $data['stat'];
						if ($stat == "y") { $stat = $lang_oui ; }
						if ($stat == "n") { $stat = $lang_non ; }

						$art = $data['art'];
						if ($art == "y") { $art = $lang_oui ; }
						if ($art == "n") { $art = $lang_non ; }

						$cli = $data['cli'];
						if ($cli == "y") { $cli = $lang_oui ; }
						if ($cli == "n") { $cli = $lang_non ; }

						$admin = $data['admin'];
						if ($admin == "y") { $admin = $lang_oui ; }
						if ($admin == "n") { $admin = $lang_non ; }

						$num_user = $data['num'];
						$nombre = $nombre +1;
						if($nombre & 1){
							$line="0";
						}else{
							$line="1"; 
						}
						?>
						<tr class="texte<?php echo "$line" ?>" onmouseover="this.className='highlight'" onmouseout="this.className='texte<?php   echo"$line" ?>'">
							<td class="highlight"><b><?php echo $nom; ?></b></td>
							<td class="highlight"><b><?php echo $prenom; ?></b></td>
							<td class="highlight"><b><?php echo $login; ?></b></td>
							<td class="highlight"><?php    echo $admin; ?></td>
							<td class="highlight"><?php    echo $dev; ?></td>
							<td class="highlight"><?php    echo $com; ?></td>
							<td class="highlight"><?php    echo $fact; ?></td>
							<td class="highlight"><?php    echo $dep; ?></td>
							<td class="highlight"><?php    echo $stat; ?></td>
							<td class="highlight"><?php    echo $art; ?></td>
							<td class="highlight"><?php    echo $cli; ?></td>
							<td class="highlight"><a href="users_edit.php?action=modif&amp;num_user=<?php echo $num_user ?>"><img src="image/edit.png" border="0" alt="<?php   echo $lang_editer ;?>" /></a></td>
							<td class="highlight">
								<?php if ($num_user > 1) { ?>
									<a href="users_delete.php?num_user=<?php echo $num_user ?>"><img src="image/delete.png" border="0" alt="<?php   echo $lang_suprimer ;?>" onclick='return confirmDelete2()' /></a>
								<?php } ?>
								</td>
						</tr>				
						<?php  
					}
				?>
					<tr>
						<td colspan="13" class="submit"></td>
					</tr>
				</table>
			</center>
		</td>
	</tr>
	<tr>
		<td>
			<?php   
			$aide = "client";
			?>
			
			<?php  
			echo"</td></tr><tr><td>";
			require_once("include/bas.php");
			?>
		</td>
	</tr>
</table>

</body>
</html>
